<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script>
function selectPerson(){
  var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain&frameName=registerCompPerItem&callBack=selectPersonCallBack&multiple=false";
		top.windowOpen(url, "selectPerson", "", 530, 700,true,"selectPerson");

  }

  function selectPersonCallBack(info){

  var onePerson= new Array();

  onePerson=info.split(";");

    for (i=0;i<onePerson.length ;i++ )
    {
     var oneAttribute= new Array();
     oneAttribute=onePerson[i].split(",");

        var userId=oneAttribute[0];
        var employeeName=oneAttribute[1];
        var deptId=oneAttribute[2];
        var dept=oneAttribute[3];

		$("trackerId").value=userId;
		$("trackerName").value=employeeName;

    }
  }

    function edit(){
    	var select = findFrame('perItemReqsOfCompelet').getSelectId();

		var isPass=$('compPerItemForm').fireEvent("onSubmit");
		if(isPass){
			closeORopenButton();
			var param = Form.serialize('compPerItemForm');

			var url = '${ctx }/occupation_perfectItemDispatchAction.do?method=registerCompPerItem&perItemReqIdSet=' + select;
			new Ajax.Request(url,{method: 'post' , parameters: param, onSuccess : function(response){
				closeORopenButton();

				ajaxSubmitException(response.responseText);

				findFrame('perfectItemDispatchList').parent.refresh();
				windowClose();

			}});
		}
	}

	function closeORopenButton(){
		$('btn1_22').disabled= !$('btn1_22').disabled;
	}
</script>
</head>

<body>
<form name="compPerItemForm" id="compPerItemForm" class="required-validate" action="">
<input type="hidden" name="perfectItemDispatchId" id="perfectItemDispatchId" value="${perItemDispatchId }" />
<input type="hidden" name="trackerId" id="trackerId" value="" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">完工登记</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" ""border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">跟进人：</td>
            <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
               <td>
                  <input type="hidden" name="trackerId" id="trackerId" />
                  <input name="trackerName" readonly="readonly" id="trackerName" type="text" class="inputtext required" size="16">
                  </td>
                  <td width="4">&nbsp;</td>
                  <td><a href="#"  onClick="selectPerson();" onFocus="this.blur()"><img src="${ctx}/images/ico_cz.gif" width="16" height="16" border="0" ></a></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">跟进日期：</td>
            <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input name="trackDate" id="trackDate" type="text" class="inputtext required validate-date-yyyy-mm-dd" size="16" /></td>
                <td width="4">&nbsp;</td>
                <td><img src="${ctx}/images/ico_clock.gif" id="trackDateImg" width="20" height="20" /></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">完工日期：</td>
            <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input name="completeDate" id="completeDate" type="text" class="inputtext required validate-date-yyyy-mm-dd" size="16" /></td>
                <td width="4">&nbsp;</td>
                <td><img id="completeDateImg" src="${ctx}/images/ico_clock.gif" width="20" height="20" /></td>
                </tr>
            </table></td>
          </tr>
            <tr>
	  	<td colspan="4" class="aux_intable_td1">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab_line">
                        <tr>
                          <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td valign="top">
                    <iframe src="${ctx }/occupation_perfectItemDispatchAction.do?method=initRegisterCompPerItem&keyword=${perItemDispatchId }" name="perItemReqsOfCompelet" id="perItemReqsOfCompelet" width="100%" height="200px" frameborder="0" scrolling="auto"> </iframe>
                                 </td>
                                      </tr>
                                  </table></td>
                                      </tr>
                                  </table>
								  </td>
	  </tr>

        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="javascript:edit();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="javascript:windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script type="text/javascript">
     Calendar.setup(
      {
       inputField : "trackDate", // ID of the input field
       ifFormat : "%Y-%m-%d", // the date format
       button : "trackDateImg", // ID of the button
      // align          :    "Tl",           // alignment (defaults to "Bl")
 		singleClick    :    true
      }
      );

     Calendar.setup(
    	      {
    	       inputField : "completeDate", // ID of the input field
    	       ifFormat : "%Y-%m-%d", // the date format
    	       button : "completeDateImg", // ID of the button
    	      // align          :    "Tl",           // alignment (defaults to "Bl")
    	 		singleClick    :    true
    	      }
    	      );
</script>
</body>
</html>